<html>
<head><meta charset="utf-8"><title>dylib linking #64872 · t-compiler · Zulip Chat Archive</title></head>
<h2>Stream: <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/index.html">t-compiler</a></h2>
<h3>Topic: <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/dylib.20linking.20.2364872.html">dylib linking #64872</a></h3>

<hr>

<base href="https://rust-lang.zulipchat.com">

<head><link href="https://rust-lang.github.io/zulip_archive/style.css" rel="stylesheet"></head>

<a name="178837377"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/dylib%20linking%20%2364872/near/178837377" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pnkfelix <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/dylib.20linking.20.2364872.html#178837377">(Oct 23 2019 at 09:38)</a>:</h4>
<p>Hey <span class="user-mention" data-user-id="124287">@mw</span> maybe we can chat here rather than via github</p>



<a name="178837521"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/dylib%20linking%20%2364872/near/178837521" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> mw <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/dylib.20linking.20.2364872.html#178837521">(Oct 23 2019 at 09:40)</a>:</h4>
<p>sure</p>



<a name="178837769"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/dylib%20linking%20%2364872/near/178837769" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> mw <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/dylib.20linking.20.2364872.html#178837769">(Oct 23 2019 at 09:43)</a>:</h4>
<p>to confirm: there is no rlib version of libstd anywhere here? (e.g. no left-over file from a previous compilation or something)</p>



<a name="178837878"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/dylib%20linking%20%2364872/near/178837878" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pnkfelix <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/dylib.20linking.20.2364872.html#178837878">(Oct 23 2019 at 09:45)</a>:</h4>
<p>hmm I thought I did cargo clean first but I'll check</p>



<a name="178838071"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/dylib%20linking%20%2364872/near/178838071" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pnkfelix <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/dylib.20linking.20.2364872.html#178838071">(Oct 23 2019 at 09:48)</a>:</h4>
<p>after <code>cargo clean &amp;&amp; cargo build</code>, we have: <code>.d</code> files for compiler_builtins, core, getopts, std, and test. We also have <code>rlib</code> and <code>rmeta</code> files for libcompiler_builtins, libcore, libgetopts. And we have libstd.dylib.</p>



<a name="178838090"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/dylib%20linking%20%2364872/near/178838090" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> mw <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/dylib.20linking.20.2364872.html#178838090">(Oct 23 2019 at 09:48)</a>:</h4>
<p>ok</p>



<a name="178838096"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/dylib%20linking%20%2364872/near/178838096" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pnkfelix <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/dylib.20linking.20.2364872.html#178838096">(Oct 23 2019 at 09:48)</a>:</h4>
<p>the minification builds very fast, by the way</p>



<a name="178838102"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/dylib%20linking%20%2364872/near/178838102" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> mw <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/dylib.20linking.20.2364872.html#178838102">(Oct 23 2019 at 09:48)</a>:</h4>
<p><a href="https://dxr.mozilla.org/rust/source/src/librustc_mir/monomorphize/collector.rs#833" target="_blank" title="https://dxr.mozilla.org/rust/source/src/librustc_mir/monomorphize/collector.rs#833">https://dxr.mozilla.org/rust/source/src/librustc_mir/monomorphize/collector.rs#833</a></p>



<a name="178838111"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/dylib%20linking%20%2364872/near/178838111" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pnkfelix <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/dylib.20linking.20.2364872.html#178838111">(Oct 23 2019 at 09:48)</a>:</h4>
<p>so if you have a computer handy, you may want to go ahead and try it locally</p>



<a name="178838116"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/dylib%20linking%20%2364872/near/178838116" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> mw <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/dylib.20linking.20.2364872.html#178838116">(Oct 23 2019 at 09:49)</a>:</h4>
<p>this is where rustc checks if there is an upstream impl available</p>



<a name="178838126"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/dylib%20linking%20%2364872/near/178838126" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pnkfelix <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/dylib.20linking.20.2364872.html#178838126">(Oct 23 2019 at 09:49)</a>:</h4>
<p>(by "builds", of course mean "gets to the final linker failure)</p>



<a name="178838142"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/dylib%20linking%20%2364872/near/178838142" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pnkfelix <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/dylib.20linking.20.2364872.html#178838142">(Oct 23 2019 at 09:49)</a>:</h4>
<blockquote>
<p>this is where rustc checks if there is an upstream impl available</p>
</blockquote>
<p>Okay I'll investigate that</p>



<a name="178838307"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/dylib%20linking%20%2364872/near/178838307" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> mw <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/dylib.20linking.20.2364872.html#178838307">(Oct 23 2019 at 09:51)</a>:</h4>
<p>and this is where stuff from dylibs should get filtered out: <a href="https://dxr.mozilla.org/rust/source/src/librustc_metadata/cstore_impl.rs#247" target="_blank" title="https://dxr.mozilla.org/rust/source/src/librustc_metadata/cstore_impl.rs#247">https://dxr.mozilla.org/rust/source/src/librustc_metadata/cstore_impl.rs#247</a></p>



<a name="178838420"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/dylib%20linking%20%2364872/near/178838420" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pnkfelix <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/dylib.20linking.20.2364872.html#178838420">(Oct 23 2019 at 09:53)</a>:</h4>
<p>too bad there's not more <code>debug!</code> instrumentation in those files. :)</p>



<a name="178838431"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/dylib%20linking%20%2364872/near/178838431" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pnkfelix <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/dylib.20linking.20.2364872.html#178838431">(Oct 23 2019 at 09:53)</a>:</h4>
<p>but I can add it readily enough</p>



<a name="178838606"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/dylib%20linking%20%2364872/near/178838606" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> mw <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/dylib.20linking.20.2364872.html#178838606">(Oct 23 2019 at 09:55)</a>:</h4>
<p><code>__ZN4core6Object6method17h3c307b2b614e132dE</code> probably comes from <code>libcore</code>?</p>



<a name="178838644"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/dylib%20linking%20%2364872/near/178838644" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> mw <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/dylib.20linking.20.2364872.html#178838644">(Oct 23 2019 at 09:55)</a>:</h4>
<p>i.e. it is already present in <code>libcore.rlib</code> which then gets linked into <code>libstd.dylib</code>?</p>



<a name="178838776"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/dylib%20linking%20%2364872/near/178838776" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pnkfelix <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/dylib.20linking.20.2364872.html#178838776">(Oct 23 2019 at 09:57)</a>:</h4>
<p>let me see</p>



<a name="178838865"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/dylib%20linking%20%2364872/near/178838865" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pnkfelix <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/dylib.20linking.20.2364872.html#178838865">(Oct 23 2019 at 09:58)</a>:</h4>
<p><code>nm -m libcore.rlib</code> says: </p>
<div class="codehilite"><pre><span></span>...
0000000000000000 (__TEXT,__text) external __ZN4core6Object6method17hacde9ba387d5faafE
...
</pre></div>



<a name="178838876"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/dylib%20linking%20%2364872/near/178838876" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pnkfelix <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/dylib.20linking.20.2364872.html#178838876">(Oct 23 2019 at 09:58)</a>:</h4>
<p>so yes that sounds right</p>



<a name="178838897"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/dylib%20linking%20%2364872/near/178838897" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pnkfelix <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/dylib.20linking.20.2364872.html#178838897">(Oct 23 2019 at 09:58)</a>:</h4>
<p>is compiling the downstream crate going to transitively look at libcore.rlib?</p>



<a name="178838916"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/dylib%20linking%20%2364872/near/178838916" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pnkfelix <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/dylib.20linking.20.2364872.html#178838916">(Oct 23 2019 at 09:59)</a>:</h4>
<p>even if the downstream crate only references libstd, not libcore?</p>



<a name="178839038"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/dylib%20linking%20%2364872/near/178839038" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> mw <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/dylib.20linking.20.2364872.html#178839038">(Oct 23 2019 at 10:00)</a>:</h4>
<p>(also, try compiling with <code>-Z symbol_mangling_version=v0</code> -- then generic args will show up in symbol names)</p>



<a name="178839096"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/dylib%20linking%20%2364872/near/178839096" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> mw <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/dylib.20linking.20.2364872.html#178839096">(Oct 23 2019 at 10:01)</a>:</h4>
<p>is the downstream crate referencing anything from libcore?</p>



<a name="178839163"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/dylib%20linking%20%2364872/near/178839163" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pnkfelix <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/dylib.20linking.20.2364872.html#178839163">(Oct 23 2019 at 10:02)</a>:</h4>
<p>well, there's kind of a diamond situation</p>



<a name="178839175"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/dylib%20linking%20%2364872/near/178839175" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pnkfelix <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/dylib.20linking.20.2364872.html#178839175">(Oct 23 2019 at 10:02)</a>:</h4>
<p>libtest has <a href="https://github.com/pnkfelix/rust_issue_64872_repro/blob/17078083f37b9e57668e1f8df9e63d60518151d7/sysroot_src/src/libtest/Cargo.toml#L11" target="_blank" title="https://github.com/pnkfelix/rust_issue_64872_repro/blob/17078083f37b9e57668e1f8df9e63d60518151d7/sysroot_src/src/libtest/Cargo.toml#L11">two upstream deps</a>, <code>getopts</code> and <code>std2</code></p>



<a name="178839227"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/dylib%20linking%20%2364872/near/178839227" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pnkfelix <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/dylib.20linking.20.2364872.html#178839227">(Oct 23 2019 at 10:03)</a>:</h4>
<p>and then just does <code>extern crate getopts;</code> (and nothing else) in its <a href="https://github.com/pnkfelix/rust_issue_64872_repro/blob/17078083f37b9e57668e1f8df9e63d60518151d7/sysroot_src/src/libtest/lib.rs#L1" target="_blank" title="https://github.com/pnkfelix/rust_issue_64872_repro/blob/17078083f37b9e57668e1f8df9e63d60518151d7/sysroot_src/src/libtest/lib.rs#L1"><code>lib.rs</code></a></p>



<a name="178839247"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/dylib%20linking%20%2364872/near/178839247" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pnkfelix <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/dylib.20linking.20.2364872.html#178839247">(Oct 23 2019 at 10:04)</a>:</h4>
<p>getopts references <code>std::Object</code></p>



<a name="178839305"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/dylib%20linking%20%2364872/near/178839305" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pnkfelix <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/dylib.20linking.20.2364872.html#178839305">(Oct 23 2019 at 10:04)</a>:</h4>
<p>(sorry for the potential confusion; at some point I renamed the local <code>std</code> to <code>std2</code>)</p>



<a name="178839342"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/dylib%20linking%20%2364872/near/178839342" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> mw <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/dylib.20linking.20.2364872.html#178839342">(Oct 23 2019 at 10:05)</a>:</h4>
<p>and it fails when trying to link libtest, right?</p>



<a name="178839355"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/dylib%20linking%20%2364872/near/178839355" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pnkfelix <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/dylib.20linking.20.2364872.html#178839355">(Oct 23 2019 at 10:05)</a>:</h4>
<p>anyway, the point is, <code>libtest</code> does not reference anything from <code>libcore</code> itself. <code>getopts</code> is <em>indirectly</em> referencing <code>trait Object</code>, which is defined in <code>libcore</code> but re-exported from <code>libstd</code></p>



<a name="178839359"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/dylib%20linking%20%2364872/near/178839359" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pnkfelix <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/dylib.20linking.20.2364872.html#178839359">(Oct 23 2019 at 10:05)</a>:</h4>
<p>that's right, it fails when trying to link <code>libtest</code>.</p>



<a name="178839493"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/dylib%20linking%20%2364872/near/178839493" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> mw <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/dylib.20linking.20.2364872.html#178839493">(Oct 23 2019 at 10:07)</a>:</h4>
<p>/me has to go get lunch now</p>



<a name="178839557"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/dylib%20linking%20%2364872/near/178839557" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pnkfelix <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/dylib.20linking.20.2364872.html#178839557">(Oct 23 2019 at 10:08)</a>:</h4>
<p>k. talk later.</p>



<a name="178839569"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/dylib%20linking%20%2364872/near/178839569" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> mw <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/dylib.20linking.20.2364872.html#178839569">(Oct 23 2019 at 10:08)</a>:</h4>
<p>I'm still not entirely clear on what the situation is exactly. I'll take another look later, actually trying to compile the repro locally</p>



<a name="178839587"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/dylib%20linking%20%2364872/near/178839587" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pnkfelix <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/dylib.20linking.20.2364872.html#178839587">(Oct 23 2019 at 10:08)</a>:</h4>
<p>did it not work out of the box for you?</p>



<a name="178839598"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/dylib%20linking%20%2364872/near/178839598" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pnkfelix <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/dylib.20linking.20.2364872.html#178839598">(Oct 23 2019 at 10:08)</a>:</h4>
<p>(it might not repro on linux)</p>



<a name="178839599"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/dylib%20linking%20%2364872/near/178839599" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> mw <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/dylib.20linking.20.2364872.html#178839599">(Oct 23 2019 at 10:08)</a>:</h4>
<p>I did not try</p>



<a name="178839603"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/dylib%20linking%20%2364872/near/178839603" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pnkfelix <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/dylib.20linking.20.2364872.html#178839603">(Oct 23 2019 at 10:08)</a>:</h4>
<p>oh okay</p>



<a name="178839615"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/dylib%20linking%20%2364872/near/178839615" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> mw <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/dylib.20linking.20.2364872.html#178839615">(Oct 23 2019 at 10:09)</a>:</h4>
<p>I only have linux available. we'll see</p>



<a name="178839819"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/dylib%20linking%20%2364872/near/178839819" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pnkfelix <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/dylib.20linking.20.2364872.html#178839819">(Oct 23 2019 at 10:12)</a>:</h4>
<p>whoa! removing <code>-C debuginfo=2</code> made the link succeed (?!)</p>



<a name="178839824"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/dylib%20linking%20%2364872/near/178839824" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pnkfelix <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/dylib.20linking.20.2364872.html#178839824">(Oct 23 2019 at 10:12)</a>:</h4>
<p>I did not expect that...</p>



<a name="178839855"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/dylib%20linking%20%2364872/near/178839855" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pnkfelix <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/dylib.20linking.20.2364872.html#178839855">(Oct 23 2019 at 10:13)</a>:</h4>
<p>namely, removing it from the compilation of <code>getopts</code> make the link succeed.</p>



<a name="178842849"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/dylib%20linking%20%2364872/near/178842849" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pnkfelix <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/dylib.20linking.20.2364872.html#178842849">(Oct 23 2019 at 11:08)</a>:</h4>
<p>hmm. I guess we must look at the libcore.rlib and/or libcore.rmeta even after we've compiled libstd to a dylib...?</p>



<a name="178843362"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/dylib%20linking%20%2364872/near/178843362" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> mw <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/dylib.20linking.20.2364872.html#178843362">(Oct 23 2019 at 11:17)</a>:</h4>
<p>Yes, Rust dylibs don't duplicate the crate metadata of rlibs they include (I think)</p>



<a name="178843496"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/dylib%20linking%20%2364872/near/178843496" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pnkfelix <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/dylib.20linking.20.2364872.html#178843496">(Oct 23 2019 at 11:19)</a>:</h4>
<p>hmm</p>



<a name="178843501"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/dylib%20linking%20%2364872/near/178843501" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pnkfelix <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/dylib.20linking.20.2364872.html#178843501">(Oct 23 2019 at 11:19)</a>:</h4>
<p>so reviewing things, I don't know how to "fix" this as is</p>



<a name="178843558"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/dylib%20linking%20%2364872/near/178843558" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pnkfelix <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/dylib.20linking.20.2364872.html#178843558">(Oct 23 2019 at 11:20)</a>:</h4>
<p>We compile libcore as an rlib (only)</p>



<a name="178843567"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/dylib%20linking%20%2364872/near/178843567" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pnkfelix <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/dylib.20linking.20.2364872.html#178843567">(Oct 23 2019 at 11:20)</a>:</h4>
<p>and then later we compile libstd as a dylib</p>



<a name="178843581"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/dylib%20linking%20%2364872/near/178843581" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pnkfelix <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/dylib.20linking.20.2364872.html#178843581">(Oct 23 2019 at 11:20)</a>:</h4>
<p>but we've already a decision to export the monomorphization from libcore</p>



<a name="178843590"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/dylib%20linking%20%2364872/near/178843590" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pnkfelix <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/dylib.20linking.20.2364872.html#178843590">(Oct 23 2019 at 11:20)</a>:</h4>
<p>and the downstream crates see that export in the metadata</p>



<a name="178843610"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/dylib%20linking%20%2364872/near/178843610" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pnkfelix <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/dylib.20linking.20.2364872.html#178843610">(Oct 23 2019 at 11:21)</a>:</h4>
<p>But its possible the "right" fix here is to change the user's code, so that they start compiling libcore with <code>crate-type = ["dylib", "rlib"]</code></p>



<a name="178843619"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/dylib%20linking%20%2364872/near/178843619" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pnkfelix <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/dylib.20linking.20.2364872.html#178843619">(Oct 23 2019 at 11:21)</a>:</h4>
<p>is that what they should have been doing from the outset anyway?</p>



<a name="178843692"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/dylib%20linking%20%2364872/near/178843692" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pnkfelix <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/dylib.20linking.20.2364872.html#178843692">(Oct 23 2019 at 11:22)</a>:</h4>
<p>Or are you supposed to be able to create crate A as an rlib, and then have crate B wrap it up as a dylib, and downstream crates C, D, etc that only see B should all be unaware that crate A was compiled as an rlib?</p>



<a name="178843778"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/dylib%20linking%20%2364872/near/178843778" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pnkfelix <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/dylib.20linking.20.2364872.html#178843778">(Oct 23 2019 at 11:24)</a>:</h4>
<p>because if you're supposed to be able to have that setup (with A:rlib, B:dylib, and no one cares), then it seems like we <em>have</em> to have B revise the crate metadata for what it took from A so that it doesn't re-export the generics.</p>



<a name="178843835"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/dylib%20linking%20%2364872/near/178843835" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> mw <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/dylib.20linking.20.2364872.html#178843835">(Oct 23 2019 at 11:25)</a>:</h4>
<p>it <em>should</em> work</p>



<a name="178843909"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/dylib%20linking%20%2364872/near/178843909" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> mw <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/dylib.20linking.20.2364872.html#178843909">(Oct 23 2019 at 11:26)</a>:</h4>
<p><a href="https://dxr.mozilla.org/rust/source/src/librustc_metadata/cstore_impl.rs#247" target="_blank" title="https://dxr.mozilla.org/rust/source/src/librustc_metadata/cstore_impl.rs#247">https://dxr.mozilla.org/rust/source/src/librustc_metadata/cstore_impl.rs#247</a> this piece of code is supposed to filter monomorphizations out in the crate that would <em>use</em> them</p>



<a name="178843936"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/dylib%20linking%20%2364872/near/178843936" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> mw <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/dylib.20linking.20.2364872.html#178843936">(Oct 23 2019 at 11:26)</a>:</h4>
<p>and symbol name disambiguation should take care of there being no symbol conflicts</p>



<a name="178843969"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/dylib%20linking%20%2364872/near/178843969" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pnkfelix <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/dylib.20linking.20.2364872.html#178843969">(Oct 23 2019 at 11:27)</a>:</h4>
<p>ah sorry, you linked that before and I didn't include it in my instrumentation</p>



<a name="178844037"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/dylib%20linking%20%2364872/near/178844037" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> mw <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/dylib.20linking.20.2364872.html#178844037">(Oct 23 2019 at 11:28)</a>:</h4>
<p>the error does not seem to occur on linux, btw :/</p>



<a name="178844060"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/dylib%20linking%20%2364872/near/178844060" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pnkfelix <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/dylib.20linking.20.2364872.html#178844060">(Oct 23 2019 at 11:29)</a>:</h4>
<p>right, I think the original bug filer noted the same</p>



<a name="178844282"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/dylib%20linking%20%2364872/near/178844282" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pnkfelix <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/dylib.20linking.20.2364872.html#178844282">(Oct 23 2019 at 11:33)</a>:</h4>
<p>ugh rustc_metadata doesn't have debug! logging. :(</p>



<a name="178844346"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/dylib%20linking%20%2364872/near/178844346" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pnkfelix <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/dylib.20linking.20.2364872.html#178844346">(Oct 23 2019 at 11:34)</a>:</h4>
<p>... or... I can't use in the <code>provide!</code> macro...?</p>



<a name="178844473"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/dylib%20linking%20%2364872/near/178844473" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pnkfelix <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/dylib.20linking.20.2364872.html#178844473">(Oct 23 2019 at 11:36)</a>:</h4>
<p>or, heh, i have to import it.</p>



<a name="178844487"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/dylib%20linking%20%2364872/near/178844487" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pnkfelix <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/dylib.20linking.20.2364872.html#178844487">(Oct 23 2019 at 11:37)</a>:</h4>
<p>/me knows how to program in Rust, really</p>



<a name="178844615"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/dylib%20linking%20%2364872/near/178844615" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> mw <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/dylib.20linking.20.2364872.html#178844615">(Oct 23 2019 at 11:39)</a>:</h4>
<p>on linux, the symbol is question is listed as undefined by <code>nm</code> for <code>libtest.so</code></p>



<a name="178844668"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/dylib%20linking%20%2364872/near/178844668" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> mw <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/dylib.20linking.20.2364872.html#178844668">(Oct 23 2019 at 11:40)</a>:</h4>
<p>but the linker just doesn't seem to care there?</p>



<a name="178844675"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/dylib%20linking%20%2364872/near/178844675" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> mw <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/dylib.20linking.20.2364872.html#178844675">(Oct 23 2019 at 11:40)</a>:</h4>
<p>because it's also unused?</p>



<a name="178844686"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/dylib%20linking%20%2364872/near/178844686" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pnkfelix <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/dylib.20linking.20.2364872.html#178844686">(Oct 23 2019 at 11:40)</a>:</h4>
<p>hmm</p>



<a name="178844900"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/dylib%20linking%20%2364872/near/178844900" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pnkfelix <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/dylib.20linking.20.2364872.html#178844900">(Oct 23 2019 at 11:43)</a>:</h4>
<blockquote>
<p><a href="https://dxr.mozilla.org/rust/source/src/librustc_metadata/cstore_impl.rs#247" target="_blank" title="https://dxr.mozilla.org/rust/source/src/librustc_metadata/cstore_impl.rs#247">https://dxr.mozilla.org/rust/source/src/librustc_metadata/cstore_impl.rs#247</a> this piece of code is supposed to filter monomorphizations out in the crate that would <em>use</em> them</p>
</blockquote>
<p>in the above statement, <em>which</em> crate do you expect to do the filtering here? getopts?</p>



<a name="178845062"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/dylib%20linking%20%2364872/near/178845062" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pnkfelix <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/dylib.20linking.20.2364872.html#178845062">(Oct 23 2019 at 11:45)</a>:</h4>
<p>in my instrumentation, <code>remove_generics</code> always ends up false (for both <code>getopts</code> and for <code>test</code>)</p>



<a name="178845236"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/dylib%20linking%20%2364872/near/178845236" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pnkfelix <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/dylib.20linking.20.2364872.html#178845236">(Oct 23 2019 at 11:46)</a>:</h4>
<p>for getopts, the linkage is always <code>None</code>. For test, the linkage is always <code>Some(Static)</code>. (and for std, the linkage is always <code>Some(Static)</code>)</p>



<a name="178845241"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/dylib%20linking%20%2364872/near/178845241" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> mw <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/dylib.20linking.20.2364872.html#178845241">(Oct 23 2019 at 11:46)</a>:</h4>
<p>libgetopts</p>



<a name="178845412"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/dylib%20linking%20%2364872/near/178845412" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> mw <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/dylib.20linking.20.2364872.html#178845412">(Oct 23 2019 at 11:49)</a>:</h4>
<p>so, when compiling <code>getopts</code> then <code> remove_generics</code> should be true for <code>libcore</code> and <code>libstd</code></p>



<a name="178845426"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/dylib%20linking%20%2364872/near/178845426" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pnkfelix <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/dylib.20linking.20.2364872.html#178845426">(Oct 23 2019 at 11:49)</a>:</h4>
<p>okay. I can dig more into why its not</p>



<a name="178846039"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/dylib%20linking%20%2364872/near/178846039" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pnkfelix <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/dylib.20linking.20.2364872.html#178846039">(Oct 23 2019 at 11:59)</a>:</h4>
<p>hmm. we are passing <code>-C prefer-dynamic</code> to compile <code>libstd</code>...</p>



<a name="178846048"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/dylib%20linking%20%2364872/near/178846048" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pnkfelix <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/dylib.20linking.20.2364872.html#178846048">(Oct 23 2019 at 11:59)</a>:</h4>
<p>and that affects the <code>dependency_formats</code> computation</p>



<a name="178846117"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/dylib%20linking%20%2364872/near/178846117" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pnkfelix <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/dylib.20linking.20.2364872.html#178846117">(Oct 23 2019 at 12:00)</a>:</h4>
<p>namely here: <a href="https://dxr.mozilla.org/rust/source/src/librustc_metadata/dependency_format.rs#85" target="_blank" title="https://dxr.mozilla.org/rust/source/src/librustc_metadata/dependency_format.rs#85">https://dxr.mozilla.org/rust/source/src/librustc_metadata/dependency_format.rs#85</a></p>



<a name="178846188"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/dylib%20linking%20%2364872/near/178846188" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pnkfelix <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/dylib.20linking.20.2364872.html#178846188">(Oct 23 2019 at 12:01)</a>:</h4>
<p>but for <code>getopts</code> we are not passing <code>-C prefer-dynamic</code></p>



<a name="178846252"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/dylib%20linking%20%2364872/near/178846252" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pnkfelix <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/dylib.20linking.20.2364872.html#178846252">(Oct 23 2019 at 12:02)</a>:</h4>
<p>Nope I'm not going to be able to just walk through this code</p>



<a name="178846255"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/dylib%20linking%20%2364872/near/178846255" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> mw <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/dylib.20linking.20.2364872.html#178846255">(Oct 23 2019 at 12:02)</a>:</h4>
<p>you see why I want to get rid of Rust dylibs <code>:P</code></p>



<a name="178846266"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/dylib%20linking%20%2364872/near/178846266" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pnkfelix <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/dylib.20linking.20.2364872.html#178846266">(Oct 23 2019 at 12:02)</a>:</h4>
<p>I'll have to instrument <code>depedency_format::calculate_type</code> to figure out what's going on there</p>



<a name="178846281"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/dylib%20linking%20%2364872/near/178846281" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> mw <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/dylib.20linking.20.2364872.html#178846281">(Oct 23 2019 at 12:02)</a>:</h4>
<p>I think only <span class="user-mention" data-user-id="116015">@Alex Crichton</span> really understands dependency formats</p>



<a name="178846408"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/dylib%20linking%20%2364872/near/178846408" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> mw <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/dylib.20linking.20.2364872.html#178846408">(Oct 23 2019 at 12:05)</a>:</h4>
<blockquote>
<p>but for <code>getopts</code> we are not passing <code>-C prefer-dynamic</code></p>
</blockquote>
<p>you might be on to something here. <span class="user-mention" data-user-id="116015">@Alex Crichton</span> might be better able to help you.</p>



<a name="178846423"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/dylib%20linking%20%2364872/near/178846423" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pnkfelix <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/dylib.20linking.20.2364872.html#178846423">(Oct 23 2019 at 12:05)</a>:</h4>
<p>yeah. I figure I'll get a little more info about what's happening whtin <code>dependency_format</code></p>



<a name="178846431"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/dylib%20linking%20%2364872/near/178846431" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pnkfelix <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/dylib.20linking.20.2364872.html#178846431">(Oct 23 2019 at 12:05)</a>:</h4>
<p>(just adding <code>-C prefer-dynamic</code> to the <code>getopts</code> compilation didn't fix anything, though)</p>



<a name="178848790"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/dylib%20linking%20%2364872/near/178848790" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pnkfelix <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/dylib.20linking.20.2364872.html#178848790">(Oct 23 2019 at 12:36)</a>:</h4>
<p>hey <span class="user-mention" data-user-id="124287">@mw</span> , in <a href="https://dxr.mozilla.org/rust/source/src/librustc_metadata/cstore_impl.rs#247" target="_blank" title="https://dxr.mozilla.org/rust/source/src/librustc_metadata/cstore_impl.rs#247">https://dxr.mozilla.org/rust/source/src/librustc_metadata/cstore_impl.rs#247</a> , it currently sets <code>remove_generics</code> to true only if it sees linkage = <code>Some(IncludedFromDylib)</code> or linkage = <code>Some(Dynamic)</code>. But what is linkage = <code>None</code> supposed to denote there?</p>



<a name="178848827"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/dylib%20linking%20%2364872/near/178848827" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pnkfelix <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/dylib.20linking.20.2364872.html#178848827">(Oct 23 2019 at 12:37)</a>:</h4>
<p>I guess you already pointed out that only <span class="user-mention" data-user-id="116015">@Alex Crichton</span> understands dependency formats</p>



<a name="178849044"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/dylib%20linking%20%2364872/near/178849044" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pnkfelix <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/dylib.20linking.20.2364872.html#178849044">(Oct 23 2019 at 12:39)</a>:</h4>
<p>(anyway I would think that if its <code>None</code>, we shouldn't be assuming we can load an upstream dep from it)</p>



<a name="178849098"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/dylib%20linking%20%2364872/near/178849098" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> mw <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/dylib.20linking.20.2364872.html#178849098">(Oct 23 2019 at 12:40)</a>:</h4>
<p>yes, I think this is a matrix of crate-nums</p>



<a name="178849115"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/dylib%20linking%20%2364872/near/178849115" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> mw <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/dylib.20linking.20.2364872.html#178849115">(Oct 23 2019 at 12:40)</a>:</h4>
<p>and <code>None</code> means that that crates just does not dependent on that other crate</p>



<a name="178849147"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/dylib%20linking%20%2364872/near/178849147" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pnkfelix <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/dylib.20linking.20.2364872.html#178849147">(Oct 23 2019 at 12:41)</a>:</h4>
<p>and if that's the case, then there shouldn't <em>be</em> anything to remove in the first place?</p>



<a name="178849234"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/dylib%20linking%20%2364872/near/178849234" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pnkfelix <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/dylib.20linking.20.2364872.html#178849234">(Oct 23 2019 at 12:42)</a>:</h4>
<p>(or rather, there shouldn't be any imports, and therefore it shouldn't matter if we remove the generics or no)</p>



<a name="178849246"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/dylib%20linking%20%2364872/near/178849246" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> mw <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/dylib.20linking.20.2364872.html#178849246">(Oct 23 2019 at 12:42)</a>:</h4>
<p>yeah, the matrix thing actually doesn;'t make sense, does it?</p>



<a name="178849259"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/dylib%20linking%20%2364872/near/178849259" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> mw <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/dylib.20linking.20.2364872.html#178849259">(Oct 23 2019 at 12:42)</a>:</h4>
<p>maybe crate nums would have to be translated?</p>



<a name="178849350"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/dylib%20linking%20%2364872/near/178849350" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> mw <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/dylib.20linking.20.2364872.html#178849350">(Oct 23 2019 at 12:44)</a>:</h4>
<p>I'm starting to think more and more that that code does not do what I thought it did</p>



<a name="178849401"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/dylib%20linking%20%2364872/near/178849401" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> mw <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/dylib.20linking.20.2364872.html#178849401">(Oct 23 2019 at 12:45)</a>:</h4>
<p>what I thought it did was: if the upstream crate in question is a dylib or an rlib that comes packaged as part of a dylib, then remove the generics</p>



<a name="178849686"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/dylib%20linking%20%2364872/near/178849686" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pnkfelix <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/dylib.20linking.20.2364872.html#178849686">(Oct 23 2019 at 12:49)</a>:</h4>
<blockquote>
<p>and <code>None</code> means that that crates just does not dependent on that other crate</p>
</blockquote>
<p>in the above, do you mean "not <em>immediately</em> dependent" ?</p>



<a name="178849708"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/dylib%20linking%20%2364872/near/178849708" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pnkfelix <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/dylib.20linking.20.2364872.html#178849708">(Oct 23 2019 at 12:49)</a>:</h4>
<p>e.g. getopts says it depends <em>just</em> on libstd</p>



<a name="178849779"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/dylib%20linking%20%2364872/near/178849779" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pnkfelix <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/dylib.20linking.20.2364872.html#178849779">(Oct 23 2019 at 12:50)</a>:</h4>
<p>and so it only has a single crate in its tcx.sess.crate_types (which I believe corresponds to libstd)</p>



<a name="178849798"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/dylib%20linking%20%2364872/near/178849798" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pnkfelix <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/dylib.20linking.20.2364872.html#178849798">(Oct 23 2019 at 12:50)</a>:</h4>
<p>but you still have DefId's running around for other crates like core</p>



<a name="178849809"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/dylib%20linking%20%2364872/near/178849809" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pnkfelix <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/dylib.20linking.20.2364872.html#178849809">(Oct 23 2019 at 12:50)</a>:</h4>
<p>So there can be an indirect dependency</p>



<a name="178849819"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/dylib%20linking%20%2364872/near/178849819" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pnkfelix <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/dylib.20linking.20.2364872.html#178849819">(Oct 23 2019 at 12:50)</a>:</h4>
<p>right?</p>



<a name="178849826"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/dylib%20linking%20%2364872/near/178849826" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> mw <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/dylib.20linking.20.2364872.html#178849826">(Oct 23 2019 at 12:51)</a>:</h4>
<p>yeah, and shouldn't it also depend on std2 in the example?</p>



<a name="178849837"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/dylib%20linking%20%2364872/near/178849837" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pnkfelix <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/dylib.20linking.20.2364872.html#178849837">(Oct 23 2019 at 12:51)</a>:</h4>
<p>oh, sorry, std2 <em>is</em> the std</p>



<a name="178849859"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/dylib%20linking%20%2364872/near/178849859" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pnkfelix <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/dylib.20linking.20.2364872.html#178849859">(Oct 23 2019 at 12:51)</a>:</h4>
<p>I think that supposed alpha-rename in my code is causing more harm than good in our discussion. :)</p>



<a name="178849891"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/dylib%20linking%20%2364872/near/178849891" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pnkfelix <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/dylib.20linking.20.2364872.html#178849891">(Oct 23 2019 at 12:52)</a>:</h4>
<div class="codehilite"><pre><span></span>[dependencies.std2]
path = &quot;../libstd&quot;
</pre></div>



<a name="178850773"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/dylib%20linking%20%2364872/near/178850773" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pnkfelix <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/dylib.20linking.20.2364872.html#178850773">(Oct 23 2019 at 13:01)</a>:</h4>
<p>Okay, here's an idea: <code>collector::should_monomorphize_locally</code> should, in its determination of whether it can link to something upstream, incorporate a similar computation to what <code>cstore_impl::exported_symbols</code> is doing. Right?</p>



<a name="178850838"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/dylib%20linking%20%2364872/near/178850838" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pnkfelix <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/dylib.20linking.20.2364872.html#178850838">(Oct 23 2019 at 13:02)</a>:</h4>
<p>that is, we should be trying to use the same logic when we tag a DefId as being something we can reliably link to from upstream</p>



<a name="178850998"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/dylib%20linking%20%2364872/near/178850998" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pnkfelix <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/dylib.20linking.20.2364872.html#178850998">(Oct 23 2019 at 13:04)</a>:</h4>
<p>that is, from the conversation so far, it sounds like a mismatch in those two computations <em>within</em> the compilation of getopts</p>



<a name="178851020"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/dylib%20linking%20%2364872/near/178851020" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pnkfelix <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/dylib.20linking.20.2364872.html#178851020">(Oct 23 2019 at 13:04)</a>:</h4>
<p>(as opposed to a mismatch across compiles of two (or more) distinct crates)</p>



<a name="178851652"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/dylib%20linking%20%2364872/near/178851652" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pnkfelix <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/dylib.20linking.20.2364872.html#178851652">(Oct 23 2019 at 13:12)</a>:</h4>
<p>(and now, reading over the comment thread on PR <a href="https://github.com/rust-lang/rust/issues/64324" target="_blank" title="https://github.com/rust-lang/rust/issues/64324">#64324</a>, I'm relieved to note that it seems like <em>everyone</em>, including <span class="user-mention" data-user-id="116015">@Alex Crichton</span> , finds the code here confusing...)</p>



<a name="178854185"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/dylib%20linking%20%2364872/near/178854185" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> mw <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/dylib.20linking.20.2364872.html#178854185">(Oct 23 2019 at 13:39)</a>:</h4>
<p><code>should_monomorphize_locally </code> is based on <code>upstream_monomorphization_for</code> which in turn is based on <code>exported_symbols</code>, so the check is already done</p>



<a name="178854297"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/dylib%20linking%20%2364872/near/178854297" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pnkfelix <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/dylib.20linking.20.2364872.html#178854297">(Oct 23 2019 at 13:40)</a>:</h4>
<p>hmm</p>



<a name="178854366"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/dylib%20linking%20%2364872/near/178854366" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> mw <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/dylib.20linking.20.2364872.html#178854366">(Oct 23 2019 at 13:41)</a>:</h4>
<p>so those are actually already factored in a way as not to duplicate the logic</p>



<a name="178854382"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/dylib%20linking%20%2364872/near/178854382" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pnkfelix <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/dylib.20linking.20.2364872.html#178854382">(Oct 23 2019 at 13:41)</a>:</h4>
<p>The result is nonetheless inconsistent</p>



<a name="178854453"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/dylib%20linking%20%2364872/near/178854453" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> mw <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/dylib.20linking.20.2364872.html#178854453">(Oct 23 2019 at 13:42)</a>:</h4>
<p>because the filtering in <code>cstore_impl::exported_symbols</code> seems to be broken, somehow</p>



<a name="178854465"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/dylib%20linking%20%2364872/near/178854465" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pnkfelix <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/dylib.20linking.20.2364872.html#178854465">(Oct 23 2019 at 13:42)</a>:</h4>
<p>Right</p>



<a name="178854549"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/dylib%20linking%20%2364872/near/178854549" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pnkfelix <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/dylib.20linking.20.2364872.html#178854549">(Oct 23 2019 at 13:43)</a>:</h4>
<p>What do you think of this: </p>
<div class="codehilite"><pre><span></span><span class="o">@@</span><span class="w"> </span><span class="o">-</span><span class="mi">243</span><span class="p">,</span><span class="mi">17</span><span class="w"> </span><span class="o">+</span><span class="mi">245</span><span class="p">,</span><span class="mi">32</span><span class="w"> </span><span class="o">@@</span><span class="w"> </span><span class="n">provide</span><span class="o">!</span><span class="w"> </span><span class="p">{</span><span class="w"> </span><span class="o">&lt;</span><span class="na">&#39;tcx</span><span class="o">&gt;</span><span class="w"> </span><span class="n">tcx</span><span class="p">,</span><span class="w"> </span><span class="n">def_id</span><span class="p">,</span><span class="w"> </span><span class="n">other</span><span class="p">,</span><span class="w"> </span><span class="n">cdata</span><span class="p">,</span><span class="w"></span>
<span class="w">         </span><span class="c1">// from this crate.</span>
<span class="w">         </span><span class="kd">let</span><span class="w"> </span><span class="n">formats</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">tcx</span><span class="p">.</span><span class="n">dependency_formats</span><span class="p">(</span><span class="n">LOCAL_CRATE</span><span class="p">);</span><span class="w"></span>
<span class="w">         </span><span class="kd">let</span><span class="w"> </span><span class="n">remove_generics</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">formats</span><span class="p">.</span><span class="n">iter</span><span class="p">().</span><span class="n">any</span><span class="p">(</span><span class="o">|</span><span class="p">(</span><span class="n">_ty</span><span class="p">,</span><span class="w"> </span><span class="n">list</span><span class="p">)</span><span class="o">|</span><span class="w"> </span><span class="p">{</span><span class="w"></span>
<span class="o">-</span><span class="w">            </span><span class="k">match</span><span class="w"> </span><span class="n">list</span><span class="p">.</span><span class="n">get</span><span class="p">(</span><span class="n">def_id</span><span class="p">.</span><span class="n">krate</span><span class="p">.</span><span class="n">as_usize</span><span class="p">()</span><span class="w"> </span><span class="o">-</span><span class="w"> </span><span class="mi">1</span><span class="p">)</span><span class="w"> </span><span class="p">{</span><span class="w"></span>
<span class="o">+</span><span class="w">            </span><span class="kd">let</span><span class="w"> </span><span class="n">linkage</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">list</span><span class="p">.</span><span class="n">get</span><span class="p">(</span><span class="n">def_id</span><span class="p">.</span><span class="n">krate</span><span class="p">.</span><span class="n">as_usize</span><span class="p">()</span><span class="w"> </span><span class="o">-</span><span class="w"> </span><span class="mi">1</span><span class="p">);</span><span class="w"></span>
<span class="o">+</span><span class="w">            </span><span class="k">match</span><span class="w"> </span><span class="n">linkage</span><span class="w"> </span><span class="p">{</span><span class="w"></span>
<span class="w">                 </span><span class="nb">Some</span><span class="p">(</span><span class="n">Linkage</span>::<span class="n">IncludedFromDylib</span><span class="p">)</span><span class="w"> </span><span class="o">|</span><span class="w"> </span><span class="nb">Some</span><span class="p">(</span><span class="n">Linkage</span>::<span class="n">Dynamic</span><span class="p">)</span><span class="w"> </span><span class="o">=&gt;</span><span class="w"> </span><span class="kc">true</span><span class="p">,</span><span class="w"></span>
<span class="o">+</span><span class="w"></span>
<span class="o">+</span><span class="w">                </span><span class="c1">// rust-lang/rust#64872 if we got `None`, then this</span>
<span class="o">+</span><span class="w">                </span><span class="c1">// must be an indirect dependency (e.g. a symbol in</span>
<span class="o">+</span><span class="w">                </span><span class="c1">// `core` that we&#39;re accessing through `std`). Best to</span>
<span class="o">+</span><span class="w">                </span><span class="c1">// assume we cannot load such monomorphization either.</span>
<span class="o">+</span><span class="w">                </span><span class="nb">None</span><span class="w"> </span><span class="o">=&gt;</span><span class="w"> </span><span class="kc">true</span><span class="p">,</span><span class="w"></span>
<span class="o">+</span><span class="w"></span>
<span class="w">                 </span><span class="n">_</span><span class="w"> </span><span class="o">=&gt;</span><span class="w"> </span><span class="kc">false</span><span class="p">,</span><span class="w"></span>
<span class="w">              </span><span class="p">}</span><span class="w"></span>
<span class="w">         </span><span class="p">});</span><span class="w"></span>
</pre></div>



<a name="178854630"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/dylib%20linking%20%2364872/near/178854630" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pnkfelix <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/dylib.20linking.20.2364872.html#178854630">(Oct 23 2019 at 13:44)</a>:</h4>
<p>I'm not thrilled with the fact that I don't really understand the <code>linkage</code> computation.</p>



<a name="178854692"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/dylib%20linking%20%2364872/near/178854692" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pnkfelix <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/dylib.20linking.20.2364872.html#178854692">(Oct 23 2019 at 13:45)</a>:</h4>
<p>i.e., should <code>dependency_formats</code> instead be returning a list that <em>includes</em> the crates that we depend on transitively?</p>



<a name="178854889"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/dylib%20linking%20%2364872/near/178854889" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> mw <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/dylib.20linking.20.2364872.html#178854889">(Oct 23 2019 at 13:47)</a>:</h4>
<p>yeah, looks like <code>None</code> and <code>Some(NotLinked)</code> are the same</p>



<a name="178854961"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/dylib%20linking%20%2364872/near/178854961" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pnkfelix <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/dylib.20linking.20.2364872.html#178854961">(Oct 23 2019 at 13:48)</a>:</h4>
<p>... but this doesn't set <code>remove_generics</code> to true for <code>Some(NotLinked)</code> either ...</p>



<a name="178854981"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/dylib%20linking%20%2364872/near/178854981" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> mw <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/dylib.20linking.20.2364872.html#178854981">(Oct 23 2019 at 13:48)</a>:</h4>
<p>which seems wrong too</p>



<a name="178855007"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/dylib%20linking%20%2364872/near/178855007" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> mw <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/dylib.20linking.20.2364872.html#178855007">(Oct 23 2019 at 13:48)</a>:</h4>
<p>but maybe in that case the list is always empty to begin with?</p>



<a name="178855010"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/dylib%20linking%20%2364872/near/178855010" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pnkfelix <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/dylib.20linking.20.2364872.html#178855010">(Oct 23 2019 at 13:48)</a>:</h4>
<p>you mean how <code>Some(NotLinked)</code> is not handled?</p>



<a name="178855029"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/dylib%20linking%20%2364872/near/178855029" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> mw <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/dylib.20linking.20.2364872.html#178855029">(Oct 23 2019 at 13:49)</a>:</h4>
<blockquote>
<p>you mean how <code>Some(NotLinked)</code> is not handled?</p>
</blockquote>
<p>yes</p>



<a name="178855051"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/dylib%20linking%20%2364872/near/178855051" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pnkfelix <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/dylib.20linking.20.2364872.html#178855051">(Oct 23 2019 at 13:49)</a>:</h4>
<p>Maybe.</p>



<a name="178855062"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/dylib%20linking%20%2364872/near/178855062" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pnkfelix <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/dylib.20linking.20.2364872.html#178855062">(Oct 23 2019 at 13:49)</a>:</h4>
<p>Certainly the list in this case is non-empty.</p>



<a name="178855083"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/dylib%20linking%20%2364872/near/178855083" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pnkfelix <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/dylib.20linking.20.2364872.html#178855083">(Oct 23 2019 at 13:49)</a>:</h4>
<p>Okay well the diff I showed you above does "fix" this</p>



<a name="178855095"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/dylib%20linking%20%2364872/near/178855095" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pnkfelix <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/dylib.20linking.20.2364872.html#178855095">(Oct 23 2019 at 13:49)</a>:</h4>
<p>Not sure if its a <em>good</em> fix</p>



<a name="178855156"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/dylib%20linking%20%2364872/near/178855156" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> mw <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/dylib.20linking.20.2364872.html#178855156">(Oct 23 2019 at 13:50)</a>:</h4>
<p>I''ve added some debug output that gives me the following for getopts:</p>



<a name="178855160"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/dylib%20linking%20%2364872/near/178855160" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> mw <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/dylib.20linking.20.2364872.html#178855160">(Oct 23 2019 at 13:50)</a>:</h4>
<div class="codehilite"><pre><span></span>crate: &quot;core&quot;
 - (NonGeneric(DefId(2:16 ~ core[ecd7]::unused[0])), Rust)
 - (Generic(DefId(2:11 ~ core[ecd7]::Object[0]::method[0]), [&amp;u32]), Rust)
crate: &quot;std&quot;
 - (NonGeneric(DefId(1:23 ~ std[c479]::__rdl_alloc[0])), Rust)
 - (NonGeneric(DefId(1:26 ~ std[c479]::__rdl_alloc_zeroed[0])), Rust)
 - (NonGeneric(DefId(1:25 ~ std[c479]::__rdl_realloc[0])), Rust)
 - (NonGeneric(DefId(1:24 ~ std[c479]::__rdl_dealloc[0])), Rust)
 - (NonGeneric(DefId(1:20 ~ std[c479]::rust_eh_personality[0])), Rust)
crate: &quot;compiler_builtins&quot;
 - (NonGeneric(DefId(3:13 ~ compiler_builtins[6753]::probestack[0]::__rust_probestack[0])), Rust)
</pre></div>



<a name="178855266"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/dylib%20linking%20%2364872/near/178855266" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> mw <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/dylib.20linking.20.2364872.html#178855266">(Oct 23 2019 at 13:51)</a>:</h4>
<blockquote>
<p>Not sure if its a good fix</p>
</blockquote>
<p>Maybe it should be:</p>
<div class="codehilite"><pre><span></span>            match linkage {
                 Some(Linkage::Static) =&gt; false,
                 _ =&gt; true,
            }
</pre></div>



<a name="178855322"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/dylib%20linking%20%2364872/near/178855322" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pnkfelix <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/dylib.20linking.20.2364872.html#178855322">(Oct 23 2019 at 13:52)</a>:</h4>
<p>heh</p>



<a name="178855375"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/dylib%20linking%20%2364872/near/178855375" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pnkfelix <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/dylib.20linking.20.2364872.html#178855375">(Oct 23 2019 at 13:52)</a>:</h4>
<p>I like it.</p>



<a name="178855406"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/dylib%20linking%20%2364872/near/178855406" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pnkfelix <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/dylib.20linking.20.2364872.html#178855406">(Oct 23 2019 at 13:53)</a>:</h4>
<p>Every other case does indeed sound like something where you shoudn't be attempting to load monomorphizations</p>



<a name="178855543"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/dylib%20linking%20%2364872/near/178855543" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> mw <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/dylib.20linking.20.2364872.html#178855543">(Oct 23 2019 at 13:54)</a>:</h4>
<p>(<a href="https://github.com/rust-lang/rust/issues/64324" target="_blank" title="https://github.com/rust-lang/rust/issues/64324">#64324</a> already is kind of a work-around)</p>



<a name="178855549"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/dylib%20linking%20%2364872/near/178855549" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pnkfelix <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/dylib.20linking.20.2364872.html#178855549">(Oct 23 2019 at 13:54)</a>:</h4>
<p>Okay I'll see about putting up a PR with that.</p>



<a name="178855571"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/dylib%20linking%20%2364872/near/178855571" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pnkfelix <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/dylib.20linking.20.2364872.html#178855571">(Oct 23 2019 at 13:54)</a>:</h4>
<p>hardest part will be making unit test(s) that accurately capture the original problem.</p>



<a name="178855579"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/dylib%20linking%20%2364872/near/178855579" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> mw <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/dylib.20linking.20.2364872.html#178855579">(Oct 23 2019 at 13:54)</a>:</h4>
<p>Yeah, r? Alex on it to be sure :)</p>



<a name="178855652"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/dylib%20linking%20%2364872/near/178855652" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pnkfelix <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/dylib.20linking.20.2364872.html#178855652">(Oct 23 2019 at 13:55)</a>:</h4>
<p>I guess I could just turn my current reduction into a <code>run-make</code> test</p>



<a name="178855747"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/dylib%20linking%20%2364872/near/178855747" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pnkfelix <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/dylib.20linking.20.2364872.html#178855747">(Oct 23 2019 at 13:56)</a>:</h4>
<p>or do we already have tests (outside of <code>run-make</code>) that exercise <code>no_core</code>+<code>no_std</code>? I guess I should look for that first.</p>



<a name="178858337"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/dylib%20linking%20%2364872/near/178858337" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alex Crichton <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/dylib.20linking.20.2364872.html#178858337">(Oct 23 2019 at 14:25)</a>:</h4>
<p><span aria-label="wave" class="emoji emoji-1f44b" role="img" title="wave">:wave:</span></p>



<a name="178858350"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/dylib%20linking%20%2364872/near/178858350" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alex Crichton <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/dylib.20linking.20.2364872.html#178858350">(Oct 23 2019 at 14:25)</a>:</h4>
<p>reading some backscroll now <span class="user-mention" data-user-id="116083">@pnkfelix</span></p>



<a name="178858456"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/dylib%20linking%20%2364872/near/178858456" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alex Crichton <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/dylib.20linking.20.2364872.html#178858456">(Oct 23 2019 at 14:26)</a>:</h4>
<p>sounds like y'all got a fix in the meantime though?</p>



<a name="178858460"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/dylib%20linking%20%2364872/near/178858460" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alex Crichton <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/dylib.20linking.20.2364872.html#178858460">(Oct 23 2019 at 14:26)</a>:</h4>
<p>happy to help clear things up if anything remains</p>



<a name="178858468"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/dylib%20linking%20%2364872/near/178858468" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alex Crichton <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/dylib.20linking.20.2364872.html#178858468">(Oct 23 2019 at 14:26)</a>:</h4>
<p><code>dependency_format</code> is the bane of my existence</p>



<a name="178858473"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/dylib%20linking%20%2364872/near/178858473" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alex Crichton <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/dylib.20linking.20.2364872.html#178858473">(Oct 23 2019 at 14:26)</a>:</h4>
<p>I'm very sad I had to write that code</p>



<a name="178865330"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/dylib%20linking%20%2364872/near/178865330" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pnkfelix <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/dylib.20linking.20.2364872.html#178865330">(Oct 23 2019 at 15:29)</a>:</h4>
<p><span class="user-mention" data-user-id="116015">@Alex Crichton</span> what do you think of the hypotheses up above? Especially with respect to the meaning of <code>linkage == None</code> ?</p>



<a name="178865500"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/dylib%20linking%20%2364872/near/178865500" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alex Crichton <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/dylib.20linking.20.2364872.html#178865500">(Oct 23 2019 at 15:30)</a>:</h4>
<p><span class="user-mention" data-user-id="116083">@pnkfelix</span> oh hm I didn't read closely enough to see the possible hypotheses</p>



<a name="178865507"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/dylib%20linking%20%2364872/near/178865507" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alex Crichton <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/dylib.20linking.20.2364872.html#178865507">(Oct 23 2019 at 15:30)</a>:</h4>
<p>do you have a link to the message?</p>



<a name="178929218"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/dylib%20linking%20%2364872/near/178929218" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pnkfelix <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/dylib.20linking.20.2364872.html#178929218">(Oct 24 2019 at 08:01)</a>:</h4>
<p><span class="user-mention" data-user-id="116015">@Alex Crichton</span> sorry, i missed your follow up Q yesterday. This is the specific thing I was asking about: <a href="#narrow/stream/131828-t-compiler/topic/dylib.20linking.20.2364872/near/178848790" title="#narrow/stream/131828-t-compiler/topic/dylib.20linking.20.2364872/near/178848790">https://rust-lang.zulipchat.com/#narrow/stream/131828-t-compiler/topic/dylib.20linking.20.2364872/near/178848790</a></p>



<a name="178960181"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/dylib%20linking%20%2364872/near/178960181" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alex Crichton <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/dylib.20linking.20.2364872.html#178960181">(Oct 24 2019 at 14:54)</a>:</h4>
<p><span class="user-mention" data-user-id="116083">@pnkfelix</span> oh ok that sounds reasonable to me as a possible solution</p>



<a name="178960189"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/dylib%20linking%20%2364872/near/178960189" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alex Crichton <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/dylib.20linking.20.2364872.html#178960189">(Oct 24 2019 at 14:54)</a>:</h4>
<p>if it passes tests sounds good to me :)</p>



<a name="179444739"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/dylib%20linking%20%2364872/near/179444739" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pnkfelix <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/dylib.20linking.20.2364872.html#179444739">(Oct 30 2019 at 15:36)</a>:</h4>
<p>hey <span class="user-mention" data-user-id="116015">@Alex Crichton</span> , regarding your comment on the -Z flag: I'm not sure if I'm communicating the situation clearly here</p>



<a name="179444764"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/dylib%20linking%20%2364872/near/179444764" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pnkfelix <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/dylib.20linking.20.2364872.html#179444764">(Oct 30 2019 at 15:36)</a>:</h4>
<p>My goal at this point is to address the semantic regression</p>



<a name="179444833"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/dylib%20linking%20%2364872/near/179444833" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pnkfelix <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/dylib.20linking.20.2364872.html#179444833">(Oct 30 2019 at 15:37)</a>:</h4>
<p>If there is a performance regression in terms of lack of sharing, that is a evidence of further work that does indeed need to be done. (Or rather, the fact that the <code>-Z</code> flag is currently necessary <em>is</em> such evidence showing that further work is necessary...)</p>



<a name="179444881"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/dylib%20linking%20%2364872/near/179444881" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pnkfelix <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/dylib.20linking.20.2364872.html#179444881">(Oct 30 2019 at 15:37)</a>:</h4>
<p>But I do not think we should be blocking PR <a href="https://github.com/rust-lang/rust/issues/65781" target="_blank" title="https://github.com/rust-lang/rust/issues/65781">#65781</a> based on the question of whether we witness a reduction in shared generics</p>



<a name="179445247"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/dylib%20linking%20%2364872/near/179445247" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pnkfelix <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/dylib.20linking.20.2364872.html#179445247">(Oct 30 2019 at 15:41)</a>:</h4>
<p>Or maybe let me put it this way: Can you, in your feedback, please address the scenario I described in my github <a href="https://github.com/rust-lang/rust/pull/65781#issuecomment-547345124" target="_blank" title="https://github.com/rust-lang/rust/pull/65781#issuecomment-547345124">comment on the PR</a> ?</p>



<a name="179446014"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/dylib%20linking%20%2364872/near/179446014" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pnkfelix <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/dylib.20linking.20.2364872.html#179446014">(Oct 30 2019 at 15:47)</a>:</h4>
<p>(Of course one possible response to all of this is to say "we should not be prioritizing a fix to the linkage problem of rlib &lt;- dylib &lt;- rlib &lt;- dylib over the (as of yet unmeasured) cost of less sharing of generics for rlibs where are currently observing <code>None</code> for the dependency_format calculation")</p>



<a name="179446160"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/dylib%20linking%20%2364872/near/179446160" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pnkfelix <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/dylib.20linking.20.2364872.html#179446160">(Oct 30 2019 at 15:49)</a>:</h4>
<p>I'm going to nominate this for discussion at the team meeting tomorrow; I think I need more input (unless I find a better fix in the meantime that is also readily backportable)</p>



<a name="179449005"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/dylib%20linking%20%2364872/near/179449005" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alex Crichton <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/dylib.20linking.20.2364872.html#179449005">(Oct 30 2019 at 16:13)</a>:</h4>
<p><span class="user-mention" data-user-id="116083">@pnkfelix</span> oh sorry yeah sure, I'll leave comments on the PR</p>



<a name="179456410"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/dylib%20linking%20%2364872/near/179456410" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pnkfelix <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/dylib.20linking.20.2364872.html#179456410">(Oct 30 2019 at 17:32)</a>:</h4>
<p>Thanks for the feedback and background info <span class="user-mention" data-user-id="116015">@Alex Crichton</span> !!! I think the steps you outlined sound good</p>



<hr><p>Last updated: Aug 07 2021 at 22:04 UTC</p>
</html>